/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.risk.control.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.risk.common.constant.enums.RiskModDictEnum;
import com.hopes.bizz.risk.common.constant.enums.RiskSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 隐患排查任务
 *
 * @author cx
 * @date 2023-07-21 10:53:12
 */
@Data
@TableName("risk_measure_task_record")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "隐患排查任务")
public class RiskMeasureTaskRecordEntity extends BaseLogicEntity {

	private static final long serialVersionUID = 1L;
	/**
	 * id
	 */
	@TableId(type = IdType.ASSIGN_ID)
	@Schema(description="id")
	private Long id;
	/**
	 * uid
	 */
	@Schema(description = "uid")
	private String uid;

	/**
	 * 风险单元标识
	 */
	@Schema(description="风险单元标识")
	private Long riskUnitId;

	/**
	 * 风险事件ID
	 */
	@Schema(description="风险事件ID")
	private Long riskEventId;

	/**
	 * 管控措施ID
	 */
	@Schema(description="管控措施ID")
	private Long riskControlId;

	/**
	 * 隐患排查配置ID
	 */
	@Schema(description="隐患排查配置ID")
	private Long riskCheckConfigId;

	/**
	 * 任务名称
	 */
	@Schema(description="任务名称")
	private String taskName;

	/**
	 * 任务类型
	 */
	@Schema(description="任务类型")
	private Integer workType;

	/**
	 * 是否包保责任人任务
	 */
	@Schema(description="是否包保责任人任务")
	private Boolean defendFlag;

	/**
	 * 隐患排查内容
	 */
	@Schema(description="隐患排查内容")
	private String checkContent;

	/**
	 * 责任人
	 */
	@Schema(description="责任人")
	private String responsibleUserIds;

	/**
	 * 开始时间
	 */

	@Schema(description="开始时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date taskStartTime;

	/**
	 * 截止时间
	 */
	@Schema(description="截止时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date taskDeadlineTime;

	/**
	 * 任务状态: 0 未完成 1 已完成 2 已过期
	 */
	@Schema(description="任务状态: 0 未完成 1 已完成 2 已过期")
	private Integer taskStatus;

	/**
	 * 处理人
	 */
	@Schema(description="处理人")
	private Long taskHandleUserId;

	/**
	 * 排查结果: 1.符合 0.不符合
	 */
	@Schema(description="排查结果: 1.符合 0.不符合")
	private Integer checkStatus;

	/**
	 * 处理时间
	 */
	@Schema(description="处理时间")
	private Date taskHandleTime;

	/**
	 * IMEI码
	 */
	@Schema(description="IMEI码")
	private String mobileMe;

	/**
	 * 描述
	 */
	@Schema(description="描述")
	private String remarks;

	/**
	 * 图片
	 */
	@Schema(description="图片")
	private String photo;

	/**
	 * 机构ID
	 */
	@Schema(description="机构ID")
	private Long orgId;

	public String getOrgIdStr() {
		return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, orgId);
	}

	public String getRiskUnitIdStr() {
		return DictResolver.getItemLabelByValue(RiskModDictEnum.risk_unit, this.riskUnitId);
	}
	public String getRiskEventIdStr() {
		return DictResolver.getItemLabelByValue(RiskModDictEnum.risk_unit_event, this.riskEventId);
	}

	public String getResponsibleUserIdsStr() {
		return DictResolver.getItemLabelByValue(AdminDictEnum.sys_user, this.responsibleUserIds);
	}

	public String getTaskHandleUserIdStr() {
		return DictResolver.getItemLabelByValue(AdminDictEnum.sys_user, this.taskHandleUserId);
	}

	public String getWorkTypeStr(){
		String itemLabelByValue = DictResolver.getItemLabelByValue(RiskSysDictEnum.risk_work_type, this.getWorkType());
		return itemLabelByValue;
	}

	public String getTaskStatusStr(){
		String itemLabelByValue = DictResolver.getItemLabelByValue(RiskSysDictEnum.task_status, this.getTaskStatus());
		return itemLabelByValue;
	}

	public String getCheckStatusStr(){
		String itemLabelByValue = DictResolver.getItemLabelByValue(RiskSysDictEnum.check_status, this.getCheckStatus());
		return itemLabelByValue;
	}
}